package com.xx.job.controller.system;


import com.xx.job.common.Result;
import com.xx.job.controller.dto.PageDTO;
import com.xx.job.entity.system.SysDictType;
import com.xx.job.service.system.SysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import com.xx.job.controller.base.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liangcy
 * @since 2021-01-14
 */
@RestController
@RequestMapping("/api/v1/dict")
public class SysDictTypeController extends BaseController {

    @Autowired
    private SysDictTypeService sysDictTypeService;

    @RequestMapping("/typelist")
    public Result typelist(PageDTO pageDTO, SysDictType sysDictType){
        return Result.success(sysDictTypeService.selectPageList(pageDTO,sysDictType));
    }

    @PostMapping("/type")
    public Result addType(@RequestBody SysDictType sysDictType){
        return Result.success(sysDictTypeService.add(sysDictType));
    }

    @DeleteMapping("/type/{id}")
    public Result deleteType(@PathVariable Long id){
        return Result.success(sysDictTypeService.delete(id));
    }

    @GetMapping("/type/{id}")
    public Result selectType(@PathVariable Long id){
        return Result.success(sysDictTypeService.select(id));
    }

    @PutMapping("/type")
    public Result updateType(@RequestBody SysDictType sysDictType){
        return Result.success(sysDictTypeService.update(sysDictType));
    }

}

